<?php
/**
 * 普通公开页面
 * 
 * @author ShuangYa
 * @package EasyAccountCenter
 * @category Controller
 * @link https://www.sylingd.com/
 * @copyright Copyright (c) 2017 ShuangYa
 * @license https://www.sylibs.com/go/easyaccount/license
 */

class IndexController extends Sy_ControllerBase {
	//检查用户状态，跳转到登录页面或个人中心
	public function indexAction() {
		if ($this->checkLogin(TRUE)) {
			$this->R('home/index/index');
		} else {
			$login_url = \Yaf\Registry::get("config")->ea->url . 'index/login/login?appid=' . \Yaf\Registry::get("config")->ea->id . '&style=0';
			$this->redirect($login_url);
		}
	}
	//注册页面
	public function registerAction() {
		$this->display('register');
	}
	//OAuth绑定页面
	public function bindAction() {
		$this->assign('id', $_POST['id']);
		$this->assign('name', $_POST['name']);
		$this->assign('info', $_POST['info']);
		$this->display('bind');
	}
	//登录跳转页面
	public function redirectAction() {
		$this->R('home/index/index');
	}
}